//
//  NSString+Regex.m
//  CPICApp
//
//  Created by sinosoft on 13-3-21.
//  Copyright (c) 2013年 lizhiwei. All rights reserved.
//

#import "NSString+Regex.h"
#import "RegexKitLite.h"

@implementation NSString (Regex)
-(BOOL) isValidEmailAddress{
    return [self isMatchedByRegex:@"[\\w\\d_]+@[\\d\\w]+\\.[\\d\\w]+"];
}
-(BOOL) isValidAge{
    return [self isMatchedByRegex:@"\\d+"];
}
-(BOOL) isValidPhone{
    return  [self isMatchedByRegex:@"^[\\d_-]{5,}$"];
}
-(BOOL) isValidCarLicense{
    return [self isMatchedByRegex:@"^(WJ|[\u0391-\uFFE5]{1,3})[A-Za-z0-9]{6,}$"];
}
-(BOOL) isValidIDNUM//身份证
{
    return ([self isMatchedByRegex:@"^[1-9]\\d{7}((0\\d)|(1[0-2]))(([0|1|2]\\d)|3[0-1])\\d{3}$"] ||
    [self isMatchedByRegex:@"^[1-9]\\d{5}[1-9]\\d{3}((0\\d)|(1[0-2]))(([0|1|2]\\d)|3[0-1])\\d{4}$"]
    ||  [self isMatchedByRegex:@"^[1-9]\\d{5}[1-9]\\d{3}((0\\d)|(1[0-2]))(([0|1|2]\\d)|3[0-1])\\d{3}[X]{1}$"]);
}
@end
